package com.atguigu.mq.listener;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MyMessageListener {

    @RabbitListener(queues = {"atguigu.queue.simple"})
    public void processMessage1(String messageContent, Message message, Channel channel) {
        System.out.println("messageContent = " + messageContent);
    }

    //定义坚挺的队列
    @RabbitListener(queues = {"atguigu.queue.message","atguigu.queue.order"})
     public void processMessage(String messageContent, Message message, Channel channel) {
        System.out.println("messageContent = " + messageContent);
    }

   /* //指定监听的队列
    @RabbitListener(queues = {"queue.transient.user"})
    public void processMessage2(String messageContent, Message message, Channel channel){
        log.info("需要消费的是" + messageContent);
        log.info(String.valueOf(message));
        log.info(channel.toString());
        System.out.println(messageContent);
    }
*/


}